<?php
namespace app\admin\controller;

class Orderdeposit extends Admin{
    public function __construct(){
        parent::__construct();
        $this->assign("model","OrderDeposit");
        $this->modelDb = model("OrderDeposit");
    }
    public function tixian(){
        $postData = input("post.postData");
        parse_str($postData,$data);
    	$status = isset($data['status']) ? $data['status'] : input("param.status/d");
    	$id = isset($data['id']) ? $data['id'] : input("param.id");
        $description = isset($data['description']) ? $data['description'] : '';
    	$info = $this->modelDb->where('id', $id)->find();
        if ($info['status'] == $status) {
            return json(['status'=>0, 'msg'=>'不能重复操作']);
        }
        //审核通过
        if ($status == 1) {
            $isok = model("Order")->pay_success($info['ordersn'], $info['price']);
        }elseif ($status == 2) {
            $isok = model("Order")->pay_fail($info['ordersn'], $info['price'], $description);
        }
        if (!$isok) {
            return json(['status'=>0, 'msg'=>'操作失败']);
        }
    	return json(['status' => 1,'msg'=>'操作成功']);
    }
    public function adddesc(){
        $this->assign('id', input('param.id'));
        $this->assign('status', input('param.status'));
        return $this->fetch();
    }
}